package lab02.test06;

import java.util.Scanner;

public class Test06 {
    public static void main(String[] args) {

        Scanner s = new Scanner(System.in);
        System.out.println("请输入要计算类型：（1：三角形，2：梯形，3：圆形，4：退出程序）");
        for(int i = 0; i <= 100;i ++){
            int x = s.nextInt();
            switch (x) {
                case 1:
                    System.out.println("请输入三角形的三边：");
                    double a = s.nextDouble();
                    double b = s.nextDouble();
                    double c = s.nextDouble();

                    Triangle t = new Triangle();
                    if (t.Triangles() == true) {
                        System.out.println("三角形的周长为:" + t.Grith());
                        System.out.println("三角形的面积为：" + t.Area());
                    }
                    break;

                case 2:
                    System.out.println("请输入梯形的上底，下底和高：");
                    double uplength = s.nextDouble();
                    double downlength = s.nextDouble();
                    double high = s.nextDouble();
                    Ladder l = new Ladder();
                    System.out.println("梯形的面积为：" + l.getArea(uplength,downlength,high));
                    break;

                case 3:
                    System.out.println("请输入圆形的半径：");
                    double r = s.nextDouble();
                    Circle sc = new Circle();
                    System.out.println("圆形的周长为："+sc.getGrith(r));
                    System.out.println("圆形的面积为："+sc.getArea(r));
                    break;
                case 4:
                    return;
            }
        }
    }
}
